package com.pabble.webnative.Interface;

import android.content.Intent;
import android.webkit.JavascriptInterface;

import com.pabble.webnative.WebActivity;

public class LifeOs extends Base{

    public LifeOs(WebActivity ctx) {
        super(ctx);
    }

    @JavascriptInterface
    public void relauncher(){
        mActivity.runOnUiThread(()->{
            mActivity.relauncher();
        });
    }
    @JavascriptInterface
    public void exit(){
        mActivity.runOnUiThread(()->{
            mActivity.finishAndRemoveTask();
            android.os.Process.killProcess(android.os.Process.myPid());
        });
    }
    @JavascriptInterface
    public void back(){
        mActivity.runOnUiThread(()->{
            mActivity.onBackActivity();
        });
    }
    @JavascriptInterface
    public String getLauncherParams(String key){
        Intent intent = mActivity.getIntent();
        return intent.getStringExtra(key);
    }
}